﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;

public class MenuPanel : MonoBehaviour
{
    [SerializeField] Button singleGameBT;
    [SerializeField] Button multiGameBT;
    [SerializeField] Button exitGameBT;
    [SerializeField] Transform lobbyPanel;

    private void Start()
    {
        singleGameBT.onClick.AddListener(StartSingleGame);
        multiGameBT.onClick.AddListener(StartMultiGame);
        exitGameBT.onClick.AddListener(ExitGame);
    }

    void StartSingleGame()
    {
        GameManager.Instance.StartSingleGame();
    }

    void StartMultiGame()
    {        
        Debug.Log("Start Multi Game");
        //打开Lobby面板
        lobbyPanel.gameObject.SetActive(true);
    }

    void ExitGame()
    {        
#if UNITY_EDITOR
        Debug.Log("Exit Play Mode");        
        UnityEditor.EditorApplication.isPlaying = false;
#else
        Debug.Log("Exit Game");
        Application.Quit();     
#endif
    }
}
